package com.gitee.vueantd.upload.repository;


import com.gitee.vueantd.upload.domain.UploadTaskData;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.Optional;

public interface UploadTaskDataRepository extends JpaSpecificationExecutor<UploadTaskData>, JpaRepository<UploadTaskData, Long> {
  Optional<UploadTaskData> findFirstByTaskUuid(String taskUuid);

  @Transactional
  @Modifying()
  @Query(value = " UPDATE upload_task_data SET thumbnail_path = ?2 WHERE id = ?1", nativeQuery = true)
  void updateThumbnailPath(Long id, String thumbnailPath);
}
